Skip to content

Conversation

bric3
Copy link
Contributor

@bric3 bric3 commented Sep 11, 2025

What Does This Do

The contributing guide describes a few rules to set on each new checkout or after a git clean -fdx. Writing those rules in the .editorconfig should make the IDE aware of them by default without having to configure anything.

Those are IJ specific (leveraging IJ .editorconfig integration), as I don't think other IDE / text editors support these.

Motivation

Ease of setup. No need to setup formater this on other worktrees.

Additional Notes

Contributor Checklist

Jira ticket: [PROJ-IDENT]

@bric3 bric3 added the tag: no release notes Changes to exclude from release notes label Sep 11, 2025
@bric3 bric3 requested a review from a team as a code owner September 11, 2025 11:44
@bric3 bric3 added the comp: tooling Build & Tooling label Sep 11, 2025
@bric3 bric3 requested a review from PerfectSlayer September 11, 2025 11:44
Comment on lines +22 to +26
ij_java_block_comment_add_space = false
ij_java_block_comment_at_first_column = false
ij_java_line_comment_add_space = true
ij_java_line_comment_add_space_on_reformat = false
ij_java_line_comment_at_first_column = false
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note: Personal take on this, I think comments should be indented by default to the correct context, instead of being at the beginning of the line.

E.g. this

  @TaskAction
  instrument() {
    workQueue().submit(InstrumentAction.class, parameters -> {
-//      parameters.buildStartedTime.set(this.invocationDetails.buildStartedTime)
-//      parameters.pluginClassPath.from(this.pluginClassPath)
-//      parameters.plugins.set(this.plugins)
+     // parameters.buildStartedTime.set(this.invocationDetails.buildStartedTime)
+     // parameters.pluginClassPath.from(this.pluginClassPath)
+     // parameters.plugins.set(this.plugins)
      parameters.instrumentingClassPath.setFrom(this.instrumentingClassPath)
      parameters.sourceDirectory.set(this.sourceDirectory.asFile)
      parameters.targetDirectory.set(this.targetDirectory.asFile)
    })
  }

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❔ question: ‏spotless enforces us to move the // near to the code while the editor puts it at the start of line by default.
Will the editor put it in the right place with this config?

Copy link
Contributor

@PerfectSlayer PerfectSlayer Sep 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 notes: My preference is having the comment at the start of the line so it really stands out and I find it easier to read during code review... But that's not the project spotless configuration 😢

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will the editor put it in the right place with this config?

Yes.

Before when commenting in the IDE, this would put the comment at the first char.

//      log.warn("Cloud Workload Security integration not supported");

Then, after a spotlessApply it would be indented as you described.

      //      log.warn("Cloud Workload Security integration not supported");

With the .editorconfig (that IntelliJ understands), the IDE will create this comment

      // log.warn("Cloud Workload Security integration not supported");

spotlessApply won't touch the above line since it is properly indented.

Comment on lines -12 to -13
indent_style=space
indent_size=2
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note: Those directives are removed because they duplicate the one in [*]. Empty sections are removed as well.

image

indent_style=space
indent_size=2
continuation_indent_size=4
ij_java_class_count_to_use_import_on_demand = 99
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note: Using 99 everywhere as some directives in other languages don't go over 100

@bric3 bric3 changed the title Encode contributing.md style guideto .editorconfig Encode contributing.md style guide to .editorconfig Sep 11, 2025
Copy link
Contributor

@PerfectSlayer PerfectSlayer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good. Thanks for the improvement!

I haven't tried myself but I guess those settings match the spotless config and do not introduce formatting changes when we ask the editor to reformat, right?

Comment on lines +22 to +26
ij_java_block_comment_add_space = false
ij_java_block_comment_at_first_column = false
ij_java_line_comment_add_space = true
ij_java_line_comment_add_space_on_reformat = false
ij_java_line_comment_at_first_column = false
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❔ question: ‏spotless enforces us to move the // near to the code while the editor puts it at the start of line by default.
Will the editor put it in the right place with this config?

@bric3 bric3 merged commit baf05d8 into master Oct 14, 2025
511 checks passed
@bric3 bric3 deleted the bdu/simple-editorconfig branch October 14, 2025 13:06
@github-actions github-actions bot added this to the 1.55.0 milestone Oct 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp: tooling Build & Tooling tag: no release notes Changes to exclude from release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants